package com.lc.hot100.lc55;

public class Main {
	public static void main(String[] args) {
		
	}
}

class Solution {
    public boolean canJump(int[] nums) {
        int max = 0;
        int n = nums.length;
        for (int i = 0; i < n - 1; i ++) {
        	if (max < i) {
        		return false;
        	}
        	max = Math.max(max, i + nums[i]);
        	if (max >= n - 1) {
        		return true;
        	}
        }
    	return max >= n - 1;
    }
}


